package Generics;

import java.util.ArrayList;

/**
 * ClassName:GenericsDome002
 * Package:Generics
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/2/8-10:53
 * @Version:v1.0
 */
public class GenericsDome002 {
    /*泛型的继承和通配符
     * 泛型不具备继承性,但是数据具备继承性*/
    public static void main(String[] args) {
        ArrayList<Ye> list1 = new ArrayList<>();
        ArrayList<Fu> list2 = new ArrayList<>();
        ArrayList<Zi> list3 = new ArrayList<>();

//        method(list1);
//        method(list2);
//        method(list3);

        list1.add(new Ye());
        list1.add(new Fu());
        list1.add(new Zi());
    }
    /*此时,泛型里面写的是什么类型,那么只能传递什么类型的数据*/
    public static void method(ArrayList<Ye> list){

    }
}
class Ye {
}

class Fu extends Ye {
}

class Zi extends Fu {
}